package com.codefish;

public class MethodOverloadSam0609 {
    /*
    题目要求：比较两个数据是否相等
    比较两个数据是否相等
    参数类型分别为两个byte类型，两个short类型，两个int类型，两个long类型
    并在main方法中进行测试
     */
    public static void main(String[] args) {

//        byte a = 10;
//        byte b = 20;
//        System.out.println(isSame(a, b));
//
//        System.out.println(isSame((short) 20, (short) 20));
//
//        System.out.println(isSame(10, 20));
//
//        System.out.println(isSame(30L, 30L));


        System.out.println(eat(1,"食物"));
        System.out.println(eat(1));
        System.out.println(eat("食物"));

    }

    public static String eat(int number, String food) {


        return number + food;
    }

    public static String eat(String food) {


        return "只有" + food;
    }

    public static String eat(int  number){
        return "只有" + number;
    }

    public static boolean isSame(byte a, byte b) {
        System.out.println("两个byte");
        boolean same;
        if (a == b) {
            same = true;
        } else {
            same = false;
        }
        return same;
    }


    public static boolean isSame(short a, short b) {
        System.out.println("两个short");
        boolean same = a == b ? true : false;
        return same;
    }


    public static boolean isSame(int a, int b) {
        System.out.println("两个int");
        return a == b;
    }


    public static boolean isSame(long a, long b) {
        System.out.println("两个long");
        if (a == b) {
            return true;
        } else {
            return false;
        }
    }


}
